<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>

    <style>
        .act{
            background-color: lightyellow;
        }
        .fo-love{
            font-size: 22px;
            color: green;
        }
    </style>
</head>
<body>
    <div id="app" >
        <template v-if="loginType === 'username'">
            <label for="username"></label>
            <input type="text" id="username" placeholder="请输入用户名">
        </template>
        <template v-else>
            <label for="email"></label>
            <input type="text" id="email" placeholder="请输入邮箱">
        </template>
        <button @click="check()" >切换登录模式</button>
    </div>

</body>
    <script>
        var  app = new Vue({
            el:'#app',
            data:{
                loginType:'username'
            },
            methods:{
                check:function () {
                    if(this.loginType === 'username'){
                        this.loginType = 'email'
                    }else{
                        this.loginType = 'username'
                    }
                }
            }
        })
    </script>
</html>